<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 字符串 API 的扩展
        let str = "hello, wanqing";
        let age = 20;
        console.log(str.startsWith("hello"));
        console.log(str.endsWith("qing"));
        console.log(str.includes("wanqing"));
        console.log(str.includes("hello"));

        // 字符串模板
        let ss = `<div>
            <span></span>
            </div>
        `
        console.log(ss);

        // 字符串插值
        let info = `我是${str}, 我要加油！`;
        console.log(info)

        // 字符串中插入表达式
        let info2 = `我是${str}, 我${age + 1}岁了！`;

        // 字符串中插入方法
        let info3 = `我是方法返回值， ${fun()}`;

        console.log(info2)

        function fun(){
            return "我是一个函数";
        }

        console.log(info3)
    </script>
</body>
</html>